﻿<%@ Page Language="C#" Culture="en-GB" UICulture="en-GB" MasterPageFile="~/WebMaster.master" AutoEventWireup="true" Inherits="EnergyEntry_electricity" Title="Untitled Page" 
    Codebehind="EnergyEntry_electricity.aspx.cs" Theme="DefaultSkin" %>

<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table>
<tr>
<td>
   <h2><asp:Label ID="lblMeterInfo" runat="server" Text="Label"></asp:Label></h2>
   <h3><asp:Label ID="lblInstructions" runat="server" Text="Label"></asp:Label></h3>
    <asp:Panel ID="panelEntry" runat="server">
    
    <asp:Label ID="Label1" runat="server" CssClass="infoLabel" Text="Reading date:"></asp:Label>
&nbsp;<asp:TextBox ID="txtElectricityDate" runat="server"></asp:TextBox>

    <asp:CalendarExtender ID="txtElectricityDate_CalendarExtender" runat="server" 
        Enabled="True" TargetControlID="txtElectricityDate" >
    </asp:CalendarExtender>

    <asp:CompareValidator ID="vldDateCurrent" runat="server" 
        ErrorMessage="Date cannot be in the future" 
        ControlToValidate="txtElectricityDate" Operator="LessThanEqual" 
        Type="Date">*</asp:CompareValidator>

    <asp:RequiredFieldValidator ID="vldDatePresent" runat="server" 
        ErrorMessage=" Must include a date" ControlToValidate="txtElectricityDate">*</asp:RequiredFieldValidator>
        

    <asp:Label ID="Label2" runat="server" CssClass="infoLabel" Text="Reading:"></asp:Label>
&nbsp;<asp:TextBox ID="txtElectricityReading" runat="server"></asp:TextBox>
    <asp:RequiredFieldValidator ID="vldReadingPresent" runat="server" 
        ErrorMessage="You must enter a valid reading" 
        ControlToValidate="txtElectricityReading">*</asp:RequiredFieldValidator>
    
    <asp:CompareValidator ID="vldReadingValid" runat="server"       
        ControlToValidate="txtElectricityReading" Operator="GreaterThanEqual" 
        Type="Double">*</asp:CompareValidator>
    <br />
    </asp:Panel>
    <asp:Chart ID="newReadingChart" runat="server" >
        <Legends>
            <asp:Legend Name="Legend1" DockedToChartArea="newReadingChartArea" Docking="Bottom" 
                IsDockedInsideChartArea="False" BackColor="Transparent" ForeColor="White">
            </asp:Legend>
        </Legends>
        <Titles>
            <asp:Title Name="Title1" Text="Review past and new readings" 
                Font="Verdana, 10pt, style=bold" ForeColor="White" />
        </Titles>
        <Series>
            <asp:Series Name="oldReadingsSeries" Legend="Legend1" LegendText="Previous readings"
                ShadowOffset="3" Color="Red"/>
            <asp:Series Name="newReadingsSeries" Legend="Legend1" LegendText="New readings" 
                ChartArea="newReadingChartArea" ShadowOffset="3" Color="Red">
            </asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="newReadingChartArea" BackColor="Transparent">
                <AxisX LineColor="Orange" LabelAutoFitStyle="None" IntervalType="Days" Title="Date" 
                    TitleForeColor="White">
                    <LabelStyle Enabled="true" ForeColor="White" Font="Verdana, 8pt"/>
                    <MajorGrid LineWidth="1" LineColor="#999999" />
                    <MajorTickMark Enabled="true" LineColor="Orange" />
                </AxisX>
                <AxisY LineColor="Orange" LabelAutoFitStyle="None" TitleForeColor="White" Title="kWh">
                    <LabelStyle Enabled="true" ForeColor="White" Font="Verdana, 8pt" />
                    <MajorGrid LineWidth="1" LineColor="#999999" />
                    <MajorTickMark Enabled="true" LineColor="Orange" />
                </AxisY>
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart>   
    <br />
  &nbsp; <asp:Label ID="lblElectricityInfo" runat="server" CssClass="infoLabel" ></asp:Label>
<br />  
    <asp:Button ID="btnSubmitElectricity" runat="server" Text="Submit" 
        onclick="btnSubmitElectricity_Click" CssClass="buttonStyle" />
        &nbsp;<asp:Button ID="btnConfirmElectricity" runat="server" Text="Confirm" 
        Visible="false" onclick="btnConfirmElectricity_Click" CssClass="buttonStyle" />

&nbsp;

    <asp:Button ID="btnCancelElectricity" runat="server" Text="Cancel" 
        Visible = "false" onclick="btnCancelElectricity_Click" 
        CssClass="buttonStyle" />


    <br />
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
    <br />
    <asp:Panel ID="panelPreviousReadings" runat="server">
 
    <asp:Label ID="Label3" runat="server" CssClass="infoLabel" Text="Previous Readings:"></asp:Label>
    <br />
    <asp:GridView ID="gridPastReadings" runat="server" AutoGenerateColumns="False" 
        BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" 
        CellPadding="4" DataKeyNames="mr_id" ForeColor="Black" 
        GridLines="Vertical" AutoGenerateDeleteButton="false" 
        AutoGenerateEditButton="false" onrowcommand="gridPastReadings_RowCommand" 
        onrowediting="gridPastReadings_RowEditing" 
        onrowdeleting="gridPastReadings_RowDeleting" >
        <RowStyle BackColor="#F7F7DE" />
        <Columns>
<asp:TemplateField ShowHeader="False">
     <ItemTemplate>
       <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
       CommandArgument ='<%# Bind("mr_id") %>'
                    OnClientClick='return confirm("Are you sure you want to delete this entry?");'
                    Text="Delete" />
     </ItemTemplate>
   </asp:TemplateField>
            <asp:BoundField DataField="mr_dateTime" DataFormatString="{0: ddd dd MMM yyyy}" 
                HeaderText="Reading Date" SortExpression="mr_dateTime" />
            <asp:BoundField DataField="mr_reading" DataFormatString="{0:0.0}" 
                HeaderText="Reading" SortExpression="mr_reading" />
        </Columns>
        <FooterStyle BackColor="#CCCC99" />
        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
     </asp:Panel>
</td>

</tr>

</table>
 
<asp:ScriptManager ID="ScriptManager1" runat="server" 
        EnableScriptGlobalization="True">
</asp:ScriptManager>

<hr />
</asp:Content>

